//-
//- @Author: CPS
//- @Date: 2020-08-09 10:06:02
//- @Last Modified by: CPS
//- @Last Modified time: 2020-08-10 23:52:45
//- @Projectname Electron-fileWatcher
//- @file_path D:\CPS\MyProject\Electron-fileWatcher\src\renderer\components\cpsDialog\template\container.pug
//- @Filename container.pug
//-
//-
//-
- var n='cpsDialog__'

mixin icon(icon)
  span(class=`${n}icon`)!= icon.svg[content.icon] ? icon.svg[content.icon] : icon.svg['file']

mixin input(eachCol)
  input(class=`${n}item-input` type=eachCol.type name=eachCol.name?eachCol.name:eachCol.text placeholder=eachCol.text?eachCol.text:'单击输入内容')

mixin text(eachCol)
  div(class=`${n}item-text ${n}item-cols-cild`)
    span= eachCol.text ? eachCol.text : '单行多列数据框'

mixin item(tar)
  for eachCol in tar
    if content.icon
      +icon(icon)

    if eachCol.type
      +input(eachCol)
    else
      +text(eachCol)

//- 本插件最外层元素是一个 section
//- section(class=`${n}component`)

div(class=`${n}container`)
  div(class=`${n}content`)
    if mode == 'row'
      //- 单行文本框
      div(class=`${n}item-single`)
        if content.type == 'input'
          +input(content)
        else
          +text(content)

        if content.icon
          +icon(icon)

    else if mode == 'cols'
      //- 单行多列数据
      -var t = 1
      div(class=`${n}item-cols`)
        +item(content)

    else if mode == 'rows'
      //- 多行多列
      div(class=`${n}item-rows`)
        //- 先遍历行
        for eachRow in content
          div(class=`${n}item-single`)
            +item(eachRow)

//- 按钮组
div(class=`${n}btnGroup`)
  span(class=`${n}btn-ture`)!= icon.svg['good']
  span(class=`${n}btn-false`)!= icon.svg['bad']